// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Aggregations
{
	public sealed partial class TermsPartition
	{
		[JsonInclude]
		[JsonPropertyName("num_partitions")]
		public long NumPartitions { get; set; }

		[JsonInclude]
		[JsonPropertyName("partition")]
		public long Partition { get; set; }
	}

	public sealed partial class TermsPartitionDescriptor : SerializableDescriptorBase<TermsPartitionDescriptor>
	{
		internal TermsPartitionDescriptor(Action<TermsPartitionDescriptor> configure) => configure.Invoke(this);
		public TermsPartitionDescriptor() : base()
		{
		}

		private long NumPartitionsValue { get; set; }

		private long PartitionValue { get; set; }

		public TermsPartitionDescriptor NumPartitions(long numPartitions)
		{
			NumPartitionsValue = numPartitions;
			return Self;
		}

		public TermsPartitionDescriptor Partition(long partition)
		{
			PartitionValue = partition;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			writer.WritePropertyName("num_partitions");
			writer.WriteNumberValue(NumPartitionsValue);
			writer.WritePropertyName("partition");
			writer.WriteNumberValue(PartitionValue);
			writer.WriteEndObject();
		}
	}
}